
<div class="think-box-shadow">
    <form action="{:sysuri()}" method="post" data-auto="true" class="layui-form layui-card" data-table-id="UserTable">
        <div class="layui-card-body padding-left-40">
            <div class="layui-row layui-col-space5">
                <div class="layui-col-xs2">
                    <div class="layui-form-item margin-bottom-5">
                        <div class="help-label"><b>头像</b></div>
                        <div class="layui-textarea help-images">
                            <input type="hidden" value="{$vo.avatar|default=''}" name="avatar">
                        </div>
                        <script>$('[name=avatar]').uploadOneImage();</script>
                    </div>
                </div>

                <div class="layui-col-xs12">
                    <div class="layui-form-item">
                        <label class="relative block">
                            <span class="color-green font-w7"><b>姓名</b></span>
                            <span class="color-desc margin-left-5"></span>
                            <input type="text" name="username" required value='{$vo.username|default=""}' placeholder="请输入姓名"
                                   class="layui-input">
                        </label>
                    </div>
                </div>
                <div class="layui-col-xs12">
                    <div class="layui-form-item">
                        <label class="relative block">
                            <span class="color-green font-w7"><b>电话</b></span>
                            <span class="color-desc margin-left-5"></span>
                            <input type="text" name="mobile" required value='{$vo.mobile|default=""}' placeholder="请输入电话"
                                   class="layui-input">
                        </label>
                    </div>
                </div>  
                <div class="layui-col-xs12">
                    <div class="layui-form-item">
                        <div class="relative block">
                            <span class="color-green font-w7"><b>状态</b></span>
                            <div class="layui-input">
                                {foreach [['title'=>'正常','value'=>1,'is_default'=>1],['title'=>'禁用','value'=>0,'is_default'=>0]] as $v }
                                {if isset($vo.status) && $vo.status==$v.value || !isset($vo.status) && $v.is_default==1 }
                                <input type="radio" name="status" checked title="{$v.title}" value="{$v.value}">
                                {else /}<input type="radio" name="status" title="{$v.title}" value="{$v.value}">
                                {/if}
                                {/foreach}
                            </div>

                        </div>
                    </div>
                </div>
                
            </div>
        </div>
        <div class="hr-line-dashed"></div>
        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
        <input type="hidden" name="spm" value="{$get.spm|default=''}">
        <div class="layui-form-item text-center">
            <button class="layui-btn" type='submit' lay-submit lay-filter="save-data">保存数据</button>
            <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>
                取消编辑
            </button>
        </div>
    </form>
</div>

<script>
    //注意：导航 依赖 element 模块，否则无法进行功能性操作
    layui.use(['element', 'form'], function () {
        var element = layui.element;
        var form = layui.form;
        form.render();
        form.on('submit(save-data)', function (data) {
            // const field=data.field;
            // if (typeof field.type === 'undefined') {
            //     layer.alert('请选择是否中奖');
            //     return  false;
            // }
            return true;
        });
    });
</script>